package com.example.campusforumapi.dao;

import com.example.campusforumapi.entity.Category;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper {
    /*
     * 返回分页数据列表
     * @param
     * @return
     * */
    @Select("select * from articlecategory order by category_id")
     List<Category> list();
    /*
     * 删除
     * @paramUser
     * */
    int delCategory(List<Integer> ids);
    /*
     * 查找相同分类名数量
     * */
    @Select("select count(*) from articlecategory where categoryName = #{categoryName}")
    int findsameCategoryName(String categoryName);
    /*
     * 查找相同分类ID数量
     * */
    @Select("select count(*) from articlecategory where category_id = #{categoryId}")
    int findsameCategoryId(Integer categoryId);
    /*
     * 添加
     * @paramCategory
     * */
    int insertCategory(Category category);

    int updCategory(Category category);

}
